﻿using System.Xml.Linq;

namespace Songhay.Xml
{
    /// <summary>
    /// Static helper members for XML-related routines.
    /// </summary>
    public static partial class XObjectUtility
    {
        /// <summary>
        /// DOCTYPE XHTML Transitional
        /// </summary>
        public static readonly XDocumentType XhtmlDocTypeTransitional =
            new XDocumentType("xhtml",
                "-//W3C//DTD XHTML 1.0 Transitional//EN",
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", null);

        /// <summary>
        /// Gets the <see cref="System.Xml.Linq.XDeclaration"/>.
        /// </summary>
        /// <param name="encoding">The encoding.</param>
        /// <param name="isStandAlone">When <c>true</c> document is stand-alone.</param>
        public static XDeclaration GetXDeclaration(string encoding = XEncoding.Utf08, bool isStandAlone = true)
        {
            var declaration = new XDeclaration("1.0",
                encoding, (isStandAlone ? "yes" : "no"));
            return declaration;
        }
    }
}
